package com.base.caselib.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.base.caselib.R;
import com.base.caselib.bean.CaseListBean;
import com.base.commonlib.http.RealNetWorkUtil;
import com.base.commonlib.recy.BasicRecyViewHolder;
import com.base.commonlib.recy.HFSingleTypeRecyAdapter;
import com.base.commonlib.utils.GlideUtil;
import com.bumptech.glide.Glide;

/**
 * Created by Administrator on 2019/10/21.
 */

public class CaseListAdapter extends HFSingleTypeRecyAdapter<CaseListBean.RowsBean,CaseListAdapter.ViewHolder> {

    Context mContext;

    public CaseListAdapter(int resId,Context mContext) {
        super(resId);
        this.mContext=mContext;
    }

    @Override
    public ViewHolder buildViewHolder(View itemView) {
        return new ViewHolder(itemView);
    }


    @Override
    public void bindDataToHolder(ViewHolder holder, CaseListBean.RowsBean caseListBean, int position) {
        holder.date.setText((String)caseListBean.getOccurredTime());
        holder.address.setText(caseListBean.getOccurredAddress());
        holder.target.setText(caseListBean.getLitigantCitizenName());
        holder.member.setText(caseListBean.getLitigantCitizenName());
        //Glide.with(mContext).load(RealNetWorkUtil.get()+"api-file/baseform/TCUx3J09urJkhIpwA0.png").placeholder(R.drawable.ic_holder_b).into(holder.imageView);
        GlideUtil.load(mContext,RealNetWorkUtil.get()+"api-file/baseform/TCUx3J09urJkhIpwA0.png",holder.imageView);
    }

    public static class ViewHolder extends BasicRecyViewHolder {

        TextView date;
        TextView address;
        TextView target;
        TextView member;
        ImageView imageView;

        public ViewHolder(View itemView) {
            super(itemView);
            date=(TextView) itemView.findViewById(R.id.date);
            address=(TextView) itemView.findViewById(R.id.address);
            target=(TextView) itemView.findViewById(R.id.target);
            member=(TextView) itemView.findViewById(R.id.member);
            imageView=(ImageView) itemView.findViewById(R.id.iv);
        }


    }
}
